<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>验收证明模版</title>
  <style>
    :root {
      --primary-color: #4361ee;
      --secondary-color: #3a0ca3;
      --accent-color: #7209b7;
      --light-color: #f8f9fa;
      --dark-color: #212529;
      --success-color: #4bb543;
      --border-color: #dee2e6;
      --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
      --button-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
    
    body {
      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
      background-color: #f5f7fa;
      margin: 0;
      padding: 20px;
      color: var(--dark-color);
    }

    .container {
      background-color: white;
      border-radius: 12px;
      box-shadow: var(--shadow);
      padding: 30px;
      margin: 0 auto;
      max-width: 1000px;
      position: relative;
      overflow: hidden;
      margin-top: 20px;
      transition: all 0.3s ease;
    }

    .container:hover {
      box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    }

    h1 {
      font-size: 28px;
      font-weight: 700;
      text-align: center;
      margin: 0 0 25px;
      padding-bottom: 15px;
      border-bottom: 2px solid var(--border-color);
      position: relative;
      color: var(--secondary-color);
    }

    .header-info {
      display: flex;
      flex-wrap: wrap;
      gap: 30px;
      margin-bottom: 30px;
      background: #f8f9fa;
      padding: 20px;
      border-radius: 8px;
      transition: all 0.3s ease;
    }

    .header-info:hover {
      background: #f1f3f5;
    }

    .header-info div {
      flex: 1;
      min-width: 300px;
    }

    .header-info p {
      margin: 12px 0;
      line-height: 1.6;
      display: flex;
    }

    .header-info strong {
      width: 100px;
      display: inline-block;
      color: var(--secondary-color);
      font-weight: 600;
    }

    .header-info span {
      flex: 1;
      padding: 5px 10px;
      border-bottom: 1px dashed #ccc;
      min-height: 24px;
      transition: all 0.2s ease;
    }

    .header-info span:focus {
      outline: none;
      background-color: #fff8e1;
      box-shadow: inset 0 0 0 2px #ffecb3;
      border-radius: 4px;
    }

    .button-container {
      position: fixed;
      top: 50%;
      right: 20px;
      transform: translateY(-50%);
      display: flex;
      flex-direction: column;
      gap: 15px;
      z-index: 100;
    }

    .download-btn {
      background: var(--button-gradient);
      color: white;
      padding: 12px 24px;
      border-radius: 50px;
      font-weight: 600;
      transition: all 0.3s ease;
      box-shadow: var(--shadow);
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 15px;
      transform: translateX(0);
    }

    .download-btn:hover {
      transform: translateX(-5px);
      box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    }

    .download-btn:active {
      transform: translateX(-2px);
      box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
    }

    .download-btn i {
      font-size: 18px;
    }

    table {
      width: 100%;
      border-collapse: collapse;
      margin-bottom: 30px;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
      border-radius: 8px;
      overflow: hidden;
      transition: all 0.3s ease;
    }

    table:hover {
      box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    }

    th, td {
      border: 1px solid var(--border-color);
      padding: 5px;
      text-align: center;
    }

    th {
      background-color: var(--primary-color);
      color: white;
      font-weight: 600;
      text-align: center;
    }

    tr:nth-child(even) {
      background-color: #f8f9fa;
    }

    tr:hover {
      background-color: #e9ecef;
      transition: background-color 0.2s ease;
    }

    [contenteditable="true"] {
      padding: 5px 8px;
      border-radius: 4px;
      transition: all 0.2s;
    }

    [contenteditable="true"]:focus {
      outline: none;
      background-color: #fff8e1;
      box-shadow: inset 0 0 0 2px #ffecb3;
    }

    .signature-area {
      display: flex;
      flex-wrap: wrap;
      gap: 40px;
      margin-top: 40px;
    }

    .signature-box {
      flex: 1;
      min-width: 300px;
    }

    .signature-box p {
      font-weight: 600;
      color: var(--secondary-color);
      margin-bottom: 15px;
      display: flex;
      align-items: center;
    }

    .signature-box i {
      margin-right: 8px;
      color: var(--primary-color);
    }

    .signature-line {
      border-top: 1px solid var(--dark-color);
      margin-top: 50px;
      padding-top: 10px;
      position: relative;
    }

    .signature-line::before {
      content: "签字：";
      position: absolute;
      left: 0;
      top: -25px;
      font-size: 14px;
      color: #666;
    }

    .date-line {
      margin-top: 50px;
      position: relative;
      padding-top: 10px;
    }

    .date-line::before {
      content: "日期：";
      position: absolute;
      left: 0;
      top: -20px;
      font-size: 14px;
      color: #666;
    }

    .date-line::after {
      content: "";
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      border-top: 1px solid var(--dark-color);
    }

    @media print {
      .button-container {
        display: none;
      }

      body {
        padding: 0;
        background-color: white;
        margin: 20px;
      }

      .container {
        box-shadow: none;
        padding: 0;
        margin: 0;
        max-width: none;
      }

      .container::before {
        height: 5px;
      }

      table, .header-info {
        box-shadow: none;
      }

      [contenteditable="true"] {
        border: none;
        padding: 0;
      }

      [contenteditable="true"]:focus {
        background-color: transparent;
        box-shadow: none;
      }
    }

    @media (max-width: 768px) {
      .container {
        padding: 20px;
      }
      
      .button-container {
        position: static;
        flex-direction: row;
        justify-content: center;
        margin: 20px 0;
        transform: none;
      }
      
      .header-info {
        gap: 15px;
        padding: 15px;
      }
      
      .download-btn {
        transform: none;
      }
      
      .download-btn:hover {
        transform: translateY(-3px);
      }
      
      .download-btn:active {
        transform: translateY(-1px);
      }
    }
  </style>
  <link rel="stylesheet" href="../css/all.min.css">
</head>

<body>
  <div class="container">
    <h1 contenteditable="true">验收证明</h1>

    <div class="button-container">
      <button class="download-btn" onclick="addRow()">
        <i class="fa fa-plus"></i> 添加项目
      </button>
      <button class="download-btn" onclick="printDocument()">
        <i class="fa fa-print"></i> 打印证明
      </button>
    </div>

    <div class="header-info">
      <div>
        <p><strong>验收单位：</strong><span contenteditable="true" id="accepting-unit" oninput="autoFillAcceptingUnit()">XX有限公司</span></p>
        <p><strong>验收单号：</strong><span contenteditable="true">YS-2025-XXXXX</span></p>
        <p><strong>联系电话：</strong><span contenteditable="true">138-XXXX-XXXX</span></p>
      </div>
      <div>
        <p><strong>被验收单位：</strong><span contenteditable="true" id="accepted-unit" oninput="autoFillAcceptedUnit()">XX有限公司</span></p>
        <p><strong>项目地址：</strong><span contenteditable="true">XX市XX区XX路XX号</span></p>
        <p><strong>联系电话：</strong><span contenteditable="true">138-XXXX-XXXX</span></p>
      </div>
    </div>

    <table id="receipt-table">
      <thead>
        <tr>
          <th width="5%">序号</th>
          <th width="35%">项目名称</th>
          <th width="25%">规格型号</th>
          <th width="15%">验收结果</th>
          <th width="20%">备注</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td style="text-align: center;">1</td>
          <td contenteditable="true"></td>
          <td contenteditable="true"></td>
          <td contenteditable="true"></td>
          <td contenteditable="true"></td>
        </tr>
      </tbody>
    </table>

    <div class="signature-area">
      <div class="signature-box">
        <p><i class="fa fa-check-circle"></i> 验收单位（盖章）：<font contenteditable="true" color="#000" id="accepting-unit-stamp">XX有限公司</font></p>
        <div class="signature-line"></div>
        <div class="date-line"></div>
      </div>
      <div class="signature-box">
        <p><i class="fa fa-info-circle"></i> 被验收单位（盖章）：<font contenteditable="true" color="#000" id="accepted-unit-stamp">XX有限公司</font></p>
        <div class="signature-line"></div>
        <div class="date-line"></div>
      </div>
    </div>
  </div>

  <script>
    // 打印文档
    function printDocument() {
      const buttons = document.querySelectorAll('.download-btn');
      buttons.forEach(button => button.style.display = 'none');

      window.print();

      setTimeout(() => {
        buttons.forEach(button => button.style.display = 'flex');
      }, 500);
    }

    // 添加新行
    function addRow() {
      const table = document.getElementById('receipt-table');
      const tbody = table.querySelector('tbody');
      const rows = tbody.querySelectorAll('tr');
      const newRow = tbody.insertRow();

      // 序号列
      const cell1 = newRow.insertCell(0);
      cell1.textContent = rows.length + 1;
      cell1.style.textAlign = 'center';

      // 项目名称
      const cell2 = newRow.insertCell(1);
      cell2.contentEditable = true;

      // 规格型号
      const cell3 = newRow.insertCell(2);
      cell3.contentEditable = true;

      // 验收结果
      const cell4 = newRow.insertCell(3);
      cell4.contentEditable = true;

      // 备注
      const cell5 = newRow.insertCell(4);
      cell5.contentEditable = true;

      // 添加行时的动画效果
      newRow.style.opacity = '0';
      newRow.style.transform = 'translateY(20px)';
      
      setTimeout(() => {
        newRow.style.transition = 'all 0.3s ease';
        newRow.style.opacity = '1';
        newRow.style.transform = 'translateY(0)';
      }, 10);

      // 更新所有序号
      updateRowNumbers();
    }

    // 更新行号
    function updateRowNumbers() {
      const rows = document.querySelectorAll('#receipt-table tbody tr');
      rows.forEach((row, index) => {
        row.cells[0].textContent = index + 1;
      });
    }

    // 自动填充验收单位
    function autoFillAcceptingUnit() {
      const acceptingUnit = document.getElementById('accepting-unit').textContent;
      document.getElementById('accepting-unit-stamp').textContent = acceptingUnit;
    }

    // 自动填充被验收单位
    function autoFillAcceptedUnit() {
      const acceptedUnit = document.getElementById('accepted-unit').textContent;
      document.getElementById('accepted-unit-stamp').textContent = acceptedUnit;
    }

    // 初始化页面
    document.addEventListener('DOMContentLoaded', () => {
      // 为所有可编辑元素添加提示
      const editableElements = document.querySelectorAll('[contenteditable="true"]');
      editableElements.forEach(el => {
        el.setAttribute('title', '点击编辑');
      });
    });
  </script>
</body>

</html>